﻿* Encoding: UTF-8.

####Coding Headline Selection as Treatment (1) or Control (0)####
    

DATASET ACTIVATE DataSet1.
RECODE Headline (1=0) (2=0) (3=1) (4=0) (5=1) (6=0) (7=1) (8=0) (9=1) (10=0) INTO Select1.
VARIABLE LABELS  Select1 'Select target or control'.
EXECUTE.


####Coding for SDT Trials#####
    
   
####### HIt and Foil Rates for Condition A
    

Create Variable for Condition A (hits)

COMPUTE A_HR=mean(sdt1_AEFH, sdt2_AEFH, sdt3_AEFH, sdt4_AEFH, sdt5_AELH, sdt6_AELH, sdt7_AELH, sdt8_AELH, sdt9_ALH, sdt10_AFH, sdt11_ALH, sdt12_AFH).
VARIABLE LABELS  A_HR 'Condition A Hit rate_mean function'.
EXECUTE.

DATASET ACTIVATE DataSet1.
RECODE A_HR(0=.01).
EXECUTE.

Create Variable for Condition A (foils)

COMPUTE A_FR=mean(sdt1_AHFF, sdt2_AHFF, sdt3_AHFF, sdt4_AHFF, sdt5_AHLF, sdt6_AHLF, sdt7_AHLF, sdt8_AHLF, sdt9_AF, sdt10_AF, sdt11_AF, sdt12_AF).
VARIABLE LABELS  A_FR 'Condition A Foil rate_mean function'.
EXECUTE.

DATASET ACTIVATE DataSet1.
RECODE A_FR(0=.01).
EXECUTE.

####### Hit and Foil Rates for Condition B

Create Variable for Condition B (hits)

COMPUTE B_HR=MEAN(sdt1_BHFH,sdt2_BHFH,sdt3_BHFH,sdt4_BHFH,sdt5_BHLH,sdt6_BHLH,sdt7_BHLH,sdt8_BHLH,
    sdt9_BLH,sdt10_BFH,sdt11_BLH,sdt12_BFH).
EXECUTE.

DATASET ACTIVATE DataSet1.
RECODE B_HR(0=.01).
EXECUTE.

Create Variable for Condition B (foils)

COMPUTE B_FR=MEAN(sdt1_BEFF,sdt2_BEFF,sdt3_BEFF,sdt4_BEFF,sdt5_BELF,sdt6_BELF,sdt7_BELF,sdt8_BELF,
    sdt9_BF,sdt10_BF,sdt11_BF,sdt12_BF).
EXECUTE.

DATASET ACTIVATE DataSet1.
RECODE B_FR(0=.01).
EXECUTE.


#########Combine Hit and Foils across all conditions 
    
DATASET ACTIVATE DataSet1.
COMPUTE HR=sum.1(A_HR,B_HR).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE FR=sum.1(A_FR,B_FR).
EXECUTE.
 
#########Calculate DPRIME 
    
COMPUTE DPrime_ALL=PROBIT(HR) - PROBIT(FR).
VARIABLE LABELS  DPrime_ALL 'DPrime Across All Conditions'.
EXECUTE.

Calculate APRIME
    
COMPUTE APrime=0.5 + (ABS(HR - FR)/(HR-FR)) * ((HR-FR)**2 + ABS(HR-FR))/(4*MAX(HR,FR)-4*HR*FR).
VARIABLE LABELS  APrime 'APrime Across All Conditions'.
EXECUTE.
    
############Calculate Beta Across All Trials
    
COMPUTE Beta_All=EXP((PROBIT(FR)**2 - PROBIT(HR)**2) / 2).
VARIABLE LABELS  Beta_All 'Beta (bias) across all conditions'.
EXECUTE.

COMPUTE LnBeta_All=Ln(Beta_All).
VARIABLE LABELS  LnBeta_All 'Beta(biased) log function, positive = no bias, negative=yes bias'.
EXECUTE.







